<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title></title>
	</head>
	<body>
		<div id="timeDiv" style="background-color: black;color: white;font-size: 40px;">
			2024-09-26 10:38:00.000
		</div>
		<script>
			// setInterval( 定时要执行的函数 , 定时执行的间隔(ms))
			setInterval(function(){
				console.log("定时执行")
				
				var d1 = new Date(); // 当前时间
				var timeStr = d1.getFullYear()+"-";
				timeStr += (d1.getMonth()+1)+"-";
				timeStr +=d1.getDate()+" ";
				timeStr +=d1.getHours()+":";
				timeStr +=d1.getMinutes()+":";
				timeStr +=d1.getSeconds()+".";
				timeStr +=d1.getMilliseconds();				
				console.log(timeStr);
				
				timeDiv.innerHTML = timeStr;
			},10);
			
			
		</script>
		
	</body>
</html>